<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function User(name){
            this.name = name;
        }
        function Admin(...args){
            User.apply(this,args); 
        }
        Admin.prototype = Object.create(User.prototype);

        let admin = new Admin('张三');
        console.log(admin)

        class User1{
            constructor(name){
                this.name = name;
            }
        }
        class Admin1 extends User1{
            constructor(...args){
                super(...args) // super必须声明在使用this之前
            }
        }
        
        let admin1 = new Admin1('李思');
        console.log(admin1)
    </script>
</body>
</html>